<p id="title">  <?php  echo $this->title; ?>  </p>
<?php
$b = 0;
$t = 0;
$c = 0;
$a = "'" . $_GET ["_module"] . "'";
echo '<table class = "table">';
echo '<thead class = "thead">';
echo '<tr>';
foreach ( $this->object as $key => $value ) {
	if ($b == 0) {
		echo '<th><img id="xcontrol" src = "'.Config::BASEURL.'layout/default/image/control1.png" style=""></th>';
		foreach ( $value as $k => $v ) {
			if (($k != "password")&&($k != "id"))
				echo '<th>' . Resource::getResource ( $k ) . '</th>';
			$b = 1;
		}
	}
}
echo '<tr>';
echo '</thead>';
echo '<tbody class="tbody">';
$flag = 1;
$car = new Car();
$sum = count($car->getall());
$display = 15;
$page = ceil($sum/$display);
$i = 1;
$hihi = 0;
echo '<div class="subpage" ><ul>';
do{
	echo '<li>';
	if(isset($_GET['start']) && (int)$_GET['start'] == ($hihi*$display))
		echo '<a style="background : white;">'.($hihi+1).'</a>';
	else
		echo '<a href = "'.Config::BASEURL.'?_module=Car&_action=getAll&start='.($display * $hihi).'">'.($hihi+1).'</a>';
	echo '</li>';
	$hihi+=1;
}while ($hihi < $page);
echo '</div></ul>';
foreach ( $this->object as $value ) {
	if ($t == 0) {
		echo '<tr class="a">';
		$t = 1;
	} else {
		echo '<tr class="b">';
		$t = 0;
	}
	echo '<td class="delete"><img id="imgdelete'.$value['id'].'" onmouseover="changeImageDel('.$value['id'].')" src="' . Config::BASEURL . 'layout/default/image/empty.png" onclick="deleteajax(' . $a . ',' . $value ['id'] . ')" style="width :32px;height :32px"></td>';
	
	foreach ( $value as $k => $v ) {
		
		if (! strcmp ( $k, 'id' )) {
			$id = $v;
		}
		
		if (! strcmp ( $k, 'username' ) || ! strcmp ( $k, 'name' ) || ! strcmp ( $k, 'numberplate' ) || ! strcmp ( $k, 'trip' ) || ! strcmp ( $k, 'car' )|| ! strcmp ( $k, 'code' ))
			echo '<td class="name"><a href="' . Config::BASEURL . '?_module=' . $_GET ['_module'] . '&_action=edit&_' . $_GET ['_module'] . 'id=' . $id . '' . '">' . $v . '</a></td>';
		else {
			if (($k == "password")||($k == "id"))
				;
			elseif ($k == "aircondition") {
			
				if ($value ['aircondition'] == 1)
					echo '<td class="aircondition"><img id="air'.$value ['id'].'" src="' . Config::BASEURL . 'layout/default/image/check.png" onclick="changeaircondition('. $value ['id'] . ',' . $value ['aircondition'] . ')"></td>';
				else
					echo '<td class="aircondition"><img id="air'.$value ['id'].'" src="' . Config::BASEURL . 'layout/default/image/uncheck.png" onclick="changeaircondition('. $value ['id'] . ',' . $value ['aircondition'] . ')"></td>';
			}
			elseif ($k == "status") {
				if ($value ['status'] == 0)
					echo '<td class="status"><img id="x'.$value ['id'].'" src="' . Config::BASEURL . 'layout/default/image/uncheck.png" onclick="changestatus(' . $a . ',' . $value ['id'] . ',' . $value ['status'] . ')"></td>';
				else if($value ['status'] == 1)
					echo '<td class="status"><img id="x'.$value ['id'].'" src="' . Config::BASEURL . 'layout/default/image/check.png" onclick="changestatus(' . $a . ',' . $value ['id'] . ',' . $value ['status'] . ')"></td>';
				else 
					echo '<td class="status"><img id="x'.$value ['id'].'" src="' . Config::BASEURL . 'layout/default/image/busy.png" onclick="changestatus(' . $a . ',' . $value ['id'] . ',' . $value ['status'] . ')"></td>';
			} else {
				if ($c > 2)
					echo '<td class="active">' . $v . '</td>';
				else
					echo '<td>' . $v . '</td>';
				$c += 1;
			}
		}
	}
	echo '</tr>';
}
echo '</tbody>';
echo '</table>';
?>



